[SUBROUTINE]
version = 1.14
icon = ellipse.png
name = _("Ellipse")
type = ellipse
help = _("<b>Create an Ellipse</b>")
order = act pv h1 cx al_x cy al_y h10 seg xr yr rot h2 opt xa dir s u_s ugc dpt u_dpt ugcd h6 fp fcs

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1

[PARAM_PV]
name = _("Show design")
icon = glasses.png
type = bool
value = 1

[PARAM_H1]
name = _("Coords")
type = sub-header

[PARAM_H10]
name = _("Size, rotation")
type = sub-header

[PARAM_CX]
name = _("X")
type = float
icon = center.png
tool_tip = _("Center of ellipse")
value = 0
metric_value = 0.0
header = h1

[PARAM_AL_X]
name = _("X axis align")
icon = align-x.png
type = combo
options = _("Left=0:Center=1:Right=2")
header = h1
value = 1
tool_tip = _("Define X reference point")

[PARAM_CY]
name = _("Y")
type = float
icon = center.png
tool_tip = _("Center of ellipse")
value = 0
metric_value = 0.0
header = h1

[PARAM_AL_Y]
name = _("Y axis align")
icon = align-y.png
type = combo
options = _("Top=0:Center=1:Bottom=2")
header = h1
value = 1
tool_tip = _("Define Y reference point")

[PARAM_XR]
name = _("X Radius")
type = float
minimum_value = 0.0
icon = ellipse-rad-x.png
tool_tip = _("Radius in X axis")
value = 2
header = h10
metric_value = 50
not_allowed = 0

[PARAM_YR]
name = _("Y Radius")
type = float
minimum_value = 0.0
icon = ellipse-rad-y.png
tool_tip = _("Radius in Y axis")
value = 1
header = h10
metric_value = 25
not_allowed = 0

[PARAM_ROT]
name = _("Rotation")
type = float
digits = 2
icon = angle.png
tool_tip = _("Angle rotated")
value = 0
header = h10
suffix = &#176;

[PARAM_SEG]
name = _("Control points")
type = int
minimum_value = 10
maximum_value = 90
icon = ellipse-points.png
tool_tip = _("Per quadrant, smoother with more")
value = 30
header = h10

[PARAM_H2]
name = _("Milling")
type = sub-header

[PARAM_OPT]
name = _("Option")
type = combo
options = _("Inside normal=0:Pocket=1:On the line=2:Outside=3")
icon = g4x.png
tool_tip = _("Select tool path")
value = 0
header = h2

[PARAM_XA]
name = _("Arc lead-out")
type = bool
icon = lead-out.png
tool_tip = _("Not if on the line")
value = 1
header = h2

[PARAM_DIR]
name = _("Direction")
type = combo
options = _("Clockwise=2:Counter-Clockwise=3")
icon = cw-ccw.png
tool_tip = _("Direction of path")
value = 3
header = h2

[PARAM_S]
name = _("Cut start")
type = combo-user
options = _("User defined=0:Surface=1:Half=2:One quarter=3:Three quarter=4:G-Code=5")
icon = surface.png
tool_tip = _("Pre or user defined")
value = 1
header = h2
links = u_s=0:ugc=5

[PARAM_U_S]
name = _("User start")
type = float
value = 0.0
metric_value = 0.0
header = h2
hidden = 1

[PARAM_UGC]
name = User gcode
type = gcode
value = 
header = h2
hidden = 1

[PARAM_UGCD]
name = User depth gcode
type = gcode
value =
header = h2
hidden = 1

[PARAM_DPT]
name = _("Cut down to")
type = combo-user
options = _("User defined=0:Through=1:Bottom=2:Half=3:One quarter=4:Three quarter=5:G-Code=6")
icon = depth.png
tool_tip = _("Pre or user defined")
value = 1
header = h2
links = u_dpt=0:ugcd=6

[PARAM_U_DPT]
name = _("User depth")
type = float
value = -0.5
metric_value = -12.0
header = h2
hidden = 1

[PARAM_H6]
name = _("Finishing")
type = sub-header

[PARAM_FP]
name = _("Finishing pass")
type = combo
options = _("None=0:Clockwise=2:Clockwise full depth=12:Counter-Clockwise=3:Counter-Clockwise full depth=13")
tool_tip = _("Conventional for better finish")
value = 0
header = h6
icon = finish.png

[PARAM_FCS]
name = _("Finishing cut")
header = h6
type = float
minimum_value = 0.01
icon = rect-pocket.png
tool_tip = _("Last finishing cut")
value = 0.040
metric_value = 1.0


[DEFINITIONS]
content =
;	<eval>self.include_once(file name here)</eval>

[CALL]
content =
	(begin #sub_name)
	(ellipse author : Fernand Veilleux)
	
	o<#self_id_active> if [#param_act]
		o<#self_id_00> if [#param_xr LT #param_yr] (if narrower than high)
			#<xr#ID>   = [#param_yr]
			#<yr#ID>   = [#param_xr]
			o<select> CALL [32] [#param_al_y] [-#<xr#ID>] [0] [#<xr#ID>]
			o<select> CALL [31] [#param_al_x] [-#<yr#ID>] [0] [#<yr#ID>]
			#<rot#ID> = [90.0 + #param_rot]
	
		o<#self_id_00> else
			#<xr#ID>   = [#param_xr]
			#<yr#ID>   = [#param_yr]
			o<select> CALL [32] [#param_al_x] [#<xr#ID>]  [0] [-#<xr#ID>]
			o<select> CALL [31] [#param_al_y] [-#<yr#ID>] [0] [#<yr#ID>]
			#<rot#ID> = #param_rot
		o<#self_id_00> endif
		
		o<select> CALL [33] [#param_s] [#param_u_s] [#<surface>] [#<surface> - #<wp_depth> / 2] [#<surface> - #<wp_depth> / 4] [#<bottom> + #<wp_depth> / 4] [#param_ugc]
		o<select> CALL [34] [#param_dpt] [#param_u_dpt] [#<bottom_through>] [#<bottom>] [#<surface> - #<wp_depth> / 2] [#<surface> - #<wp_depth> / 4] [#<bottom> + #<wp_depth> / 4] [#param_ugcd]
		
		o<ellipse> CALL [#param_cx] [#param_cy] [#<xr#ID>] [#<yr#ID>] [#<rot#ID>] [#32] [#31] [#param_seg] [#param_opt] [#param_dir] [#33] [#34] [#param_pv] [#param_fp] [#param_fcs] [#param_xa]
		
	o<#self_id_active> endif
	(end #sub_name)
